﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using FTP = FTPSClient;
using System.ComponentModel;

namespace Vision.Core.ActivityComponents.IO.Ftp
{
    [Designer(typeof(Vision.Core.ActivityComponents.IO.Ftp.FtpRemoveFileDesigner))]
    public class FtpRemoveFile : NativeActivity
    {
        /// <summary>
        /// 
        /// </summary>
        internal FTP.FTPSClient FtpClient { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public InArgument<string> FileName { get; set; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        protected override void Execute(NativeActivityContext context)
        {
            this.FtpClient = (FTP.FTPSClient)context.Properties.Find("5AED2CE1-FB3C-45B3-9CB7-3DC8CD5E4C56");

            if (this.FtpClient != null)
            {
                this.FtpClient.DeleteFile(this.FileName.Get(context));
            }
        }
    }
}
